package com.arithmeticEveryDay.leetCode;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class SolutionLCR080 {
    
    List<List<Integer>> result;
    List<Integer> tempCombine;
    
    
    public List<List<Integer>> combine(int n, int k) {
        result = new ArrayList<List<Integer>>();
        tempCombine = new ArrayList<Integer>();
        dfs(n, k, 0, 1);
        return result;
    }

    private void dfs(int n, int k, int step, int startIndex) {
        System.out.println(tempCombine + ", " + step);
        if (step == k) {
            result.add(new ArrayList<Integer>(tempCombine));
            return;
        }
        for (int i = startIndex; i <= n; i++) {
            tempCombine.add(i);
            dfs(n, k, step+1, i+1);
            tempCombine.remove(step);
        }
        
    }

    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int k = scan.nextInt();
        SolutionLCR080 s = new SolutionLCR080();
        System.out.println(s.combine(n, k));

    }

}
